package cn.le;

import org.springframework.stereotype.Component;

/**
 * 项目名  spring-boot
 * Created by lansp
 * Created at 2018/6/20
 * 描述:
 */
@Component
public class Consumer {

	//可或
	/*@KafkaListener(topics = {"nodeTopic1"})
	public void listen(ConsumerRecord<?,?> record){
		Optional<?> kafkaMsg = Optional.ofNullable(record.value());
		if (kafkaMsg.isPresent()){
			Object msg = kafkaMsg.get();
			System.out.println("-------->"+record);
			System.out.println("-------->"+msg);
		}
	}*/
	//只获取发送的消息
	//@KafkaListener(topics = {"zhao"})
	public void listen(String msg){
		System.out.println("实时数据接收消息-------------->:"+msg);
	}

	//@KafkaListener(topics = {"test8"})
	public void test2(String msg){
		System.out.println("sink接收消息-------------->:"+msg);
	}
}
